package com.demo.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.stereotype.Component;

public class MyInterceptor implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        System.out.println("MyInterceptor invoke ...");
        System.out.println("method "+invocation.getMethod()+" is called on "+
                invocation.getThis()+" with args "+invocation.getArguments());
        Object ret=invocation.proceed();
        System.out.println("method "+invocation.getMethod()+" returns "+ret);
        return ret;
    }
}
